package com.lagou.dockerdemo.controller;

import com.lagou.dockerdemo.entity.Tbstudent;
import com.lagou.dockerdemo.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/student")
public class StudentController {

    @Autowired
    private StudentService studentService;

    @GetMapping
    public Tbstudent getById(Integer id) {
        Tbstudent tbstudent = studentService.getById(id);
        return tbstudent;
    }

    @PostMapping
    public String insert(@RequestBody Tbstudent tbstudent) {
        studentService.insert(tbstudent);
        return "INSERT OK";
    }
}
